Skip to content

test(jest-transforms): cover the SVG component name helper - #21029

Merged
vbudhram merged 1 commit into
mainfrom
fxa-13929
Aug 18, 2026
Merged

test(jest-transforms): cover the SVG component name helper#21029
vbudhram merged 1 commit into
mainfrom
fxa-13929

Conversation

@vbudhram

@vbudhram vbudhram commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Because

  • The toPascalCase helper that replaced camelcase has no direct test in either copy.
  • Coverage today is indirect. LoadingSpinner and ButtonIcon render an SVG and never assert the generated name, so the separator, camelCase and digit rules can break without a test failing.

This pull request

  • Adds packages/fxa-react/lib/svg-transform.test.ts. It asserts the generated component name for six basename shapes.
  • Adds packages/fxa-settings/src/lib/jest-file-transform.test.ts with the same six shapes, against the second copy of the helper.
  • Touches no helper logic. This is a test-only follow-up to review comments on the original change.

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13929

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on: the two new spec files, and the six cases in each it.each table.
  • Suggested review order: the fxa-react spec first. The fxa-settings spec is the same table against the other copy.
  • Risky or complex parts: where the second spec lives. fxa-settings sets jest roots to src, so a spec placed beside config/jest/fileTransform.js would never run. The spec sits under src/lib/ and imports the transform by relative path. No jest config changed. I also broke one expectation in each file on purpose, confirmed both specs failed, then restored them.

Screenshots (Optional)

Other information (Optional)

The six cases are trash-icon, trash_icon, trash.icon, closeIcon, icon2x and close. They pin the three separators, an input that is already camelCase, the digit-to-letter uppercase rule, and a plain single word.

Both transforms prefix Svg, so both specs assert the full SvgTrashIcon shape.

The helper is still duplicated across the two packages. That is deliberate for now. Consolidating it would touch package boundaries and jest configs, which is a bigger call than this follow-up. These two specs are what stop the copies drifting apart.

@vbudhram
vbudhram requested a review from a team as a code owner August 13, 2026 19:13
@vbudhram vbudhram added the auto label Aug 13, 2026
Copilot AI balanced review requested due to automatic review settings August 13, 2026 19:13
@vbudhram vbudhram added the auto label Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces camelcase with package-local SVG basename conversion helpers to reduce dependencies.

Changes:

  • Adds identical toPascalCase helpers to both Jest SVG transforms.
  • Removes direct camelcase dependencies and updates the lockfile.
  • Direct regression coverage for the helpers is still needed.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/fxa-react/svg-transform.js Adds local PascalCase conversion.
packages/fxa-react/package.json Removes camelcase.
packages/fxa-settings/config/jest/fileTransform.js Adds local PascalCase conversion.
packages/fxa-settings/package.json Removes camelcase.
yarn.lock Updates workspace dependency records.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/fxa-react/svg-transform.js
Comment thread packages/fxa-settings/config/jest/fileTransform.js
## Because

- The `toPascalCase` helper that replaced `camelcase` has no direct test in either copy.
- Coverage today is indirect. `LoadingSpinner` and `ButtonIcon` render an SVG and never assert the generated name, so the separator, camelCase and digit rules can break without a test failing.

## This pull request

- Adds `packages/fxa-react/lib/svg-transform.test.ts`. It asserts the generated component name for six basename shapes.
- Adds `packages/fxa-settings/src/lib/jest-file-transform.test.ts` with the same six shapes, against the second copy of the helper.
- Touches no helper logic. This is a test-only follow-up to review comments on the original change.

## Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13929
@vbudhram vbudhram changed the title chore(deps): replace camelcase with a local helper in SVG transforms test(jest-transforms): cover the SVG component name helper Aug 18, 2026

@toufali toufali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helper is copy-pasted into both transforms. Leaving it instead of unifying since there's no clean shared place to put it. If a third copy shows up, DRY it then!

@vbudhram
vbudhram merged commit eb218a3 into main Aug 18, 2026
21 checks passed
@vbudhram
vbudhram deleted the fxa-13929 branch August 18, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants